package app.texas.com.devilfishhouse.Base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.universal_library.activity.BaseActivity;
import com.universal_library.activity.BaseBackActivity;

import butterknife.ButterKnife;


/**
 * Created by lenovo on 2018/5/21.
 */
public abstract class BaseView extends BaseBackActivity implements BaseIView {
    protected BasePresenter mPresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        ButterKnife.bind(this);
        mPresenter = getPresenter();
        mPresenter.oncreate();
        initView();
    }

    protected abstract int getLayoutId();

    protected abstract BasePresenter getPresenter();

    //初始化view
    protected void initView() {
        ButterKnife.bind(this);

    }

    //绑定数据
    @Override
    public void setData(Object data) {

    }

    @Override
    protected void onResume() {
        super.onResume();
        mPresenter.onResume();
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.onDestory();
    }
}
